package LeetCode.month02.day51;
import LeetCode.month02.day50.ListNode;

public class No82 {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode newhead = new ListNode(0,head);
        ListNode cur = newhead;
        while (cur.next != null && cur.next.next != null) {
            int val = cur.next.val;
            if(cur.next.next.val==val){
                while(cur.next != null && cur.next.val==val){
                    cur.next = cur.next.next;
                }
            }else{
                cur = cur.next;
            }
        }
        return newhead.next;
    }
}
